# -*- coding: utf-8 -*-
from django.db import models

# Create your models here.
from django.db import models
from django.contrib.auth.models import User
from zhp_blog.models import Article


class Comment(models.Model):
    # article = models.ForeignKey(
    #     Article,
    #     on_delete=models.CASCADE,
    #     related_name='comments'
    # )
    # user = models.ForeignKey(
    #     User,
    #     on_delete=models.CASCADE,
    #     related_name='comments'
    # )
    body = models.TextField()
    created = models.DateTimeField(auto_now_add=True)
    hid = models.PositiveIntegerField(default=0)
    user_ip = models.CharField(max_length=20,default='')

    class Meta:
        app_label = 'zhp_blog'
        ordering = ('created',)
        db_table = "comment"
        verbose_name_plural = "品论"

    def __str__(self):
        return self.body[:20]
